	import {
		get,
		post
	} from '../utils/request.js'

export function getBanner(number){
	return get(`/api/weChat/applet/course/banner/list?number=${number}`)
}

export function getCourseListByType(type,pageNum=1,pageSize=6){
	return post("/api/weChat/applet/course/list/type",{
		type,
		pageNum,
		pageSize
	}).then(res=>{
		res.data.rows = res.data.rows.map(item=>({
			...item,
			isFree:item.isFree == '1'||item.isFree == 1,
			isDiscount:item.isDiscount == '1'||item.isDiscount == 1
		}))
		return res;
	})
}


export function subjectList(){
	return post("/api/weChat/applet/subject/list",{enable: '1'},{
		header:{
			"Content-Type":"application/json"
		}
	})
}